package com.zqxq.lottery.controller.sys;

import com.zqxq.common.constant.Result;
import com.zqxq.common.enums.CodeEnum;
import com.zqxq.lottery.service.sys.IUserAgentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author 苦智
 * @date 2018/7/9 17:22
 * @description 代理商管理
 * @ClassName UserAgentController
 */
@RestController
@Slf4j
@RequestMapping("/sysAgent")
public class UserAgentController {

    @Autowired
    private IUserAgentService userAgentService;

    @PostMapping("/getUserAgentData")
    public Result getUserAgentData(String startTime, String endTime, String agentId,
                                   @RequestParam(defaultValue = "1") Integer timeType,
                                   Integer pageNo,Integer pageSize){
        log.info("代理商管理后台，参数列表startTime={},endTime={},agentId={},timeType={}",startTime,endTime,agentId,timeType);
        if (pageNo == null)
            pageNo = 1;
        if (pageSize == null)
            pageSize = 10;
        Map<String,Object> resultMap = userAgentService.getUserAgentData(startTime,endTime,agentId,timeType,pageNo,pageSize);
        return new Result(CodeEnum.SUCCESS.getCode(),"查询成功",resultMap);
    }
}
